// /api/user/info
async function getUserInfo(ctx) {
    return await ctx.get('/api/user/info');
}
//查询交易流水
async function getTransactionsForAccountId(params, ctx) {
    return await ctx.get('/api/accounts/' + params.accountId + '/transactions', params);
}
//获取特定账户余额
async function getBalanceForAccountId(params, ctx) {
    return await ctx.get('/api/accounts/' + params.accountId + '/balance', params);
}
//查询实名认证信息列表
async function getLegalEntities(params, ctx) {
    return await ctx.get('/api/accounts/' + params.accountId + '/legal_entities', params);
}
//发送邮件验证码
async function sendVerification(ctx) {
    return await ctx.get('/api/email/send_verification');
}
//验证邮件码
async function verificationCode(params, ctx) {
    return await ctx.get('/api/email/valid/' + params);
}

//提现相关
//获取银行卡信息列表
async function getBankAccountList(accountId, ctx) {
    return await ctx.get('/api/accounts/' + accountId + '/bank_accounts');
}

//提现预览， 预估提现手续费用等
async function getExtractPreview(params, ctx) {
    return await ctx.post('/api/accounts/' + params.accountId + '/withdraw_preview');
}

//申请虚拟银行账户
async function virtualBankAccountApplications(params, ctx) {
    return await ctx.post('/api/accounts/' + params.accountId + '/virtual_bank_account_applications', params);
}
//申请虚拟银行账户-提现
async function applyBankAccount(params, ctx) {
    return await ctx.post('/api/accounts/' + params.accountId + '/bank_accounts', params.param);
}

//查询实名认证信息列表
async function getBankAccountsList(params, ctx) {
    return await ctx.get('/api/accounts/' + params.accountId + '/bank_accounts', params);
}

//查询(审核通过)虚拟银行账户列表
async function getVirtualBankAccountsList(params, ctx) {
    return await ctx.get('/api/accounts/' + params.accountId + '/virtual_bank_accounts', params);
}

export const settlement = {
    getUserInfo,
    getBalanceForAccountId,
    getLegalEntities,
    sendVerification,
    verificationCode,
    getTransactionsForAccountId,
    getBankAccountList,//提现====》》》 获取银行卡信息列表
    getExtractPreview, //提现===》》》 获取提现预览，即获取手续费，实际到账费用等
    virtualBankAccountApplications,
    applyBankAccount,
    getBankAccountsList,
    getVirtualBankAccountsList
}